package com.hp.bon.sgw.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "SGW_PROV_TRAFFIC_LMT_CFG")
public class ProvTrafficLmtCfg {
	private String provId;
	private long period;
	private long limitRecNum;	
	private String node;
	private int counter;//非配置表字段，周期内的计数器
	private long resetTime;//非配置表字段，重置时间

	@Id
	@Column(name = "PROV_ID")
	public String getProvId() {
		return provId;
	}

	public void setProvId(String provId) {
		this.provId = provId;
	}
	
	@Column(name = "PERIOD")
	public long getPeriod() {
		return period;
	}


	public void setPeriod(long period) {
		this.period = period;
	}

	@Column(name = "LIMIT_REC_NUM")
	public long getLimitRecNum() {
		return limitRecNum;
	}

	public void setLimitRecNum(long limitRecNum) {
		this.limitRecNum = limitRecNum;
	}
	
	@Column(name = "REQ_HOST")
	public String getNode() {
		return node;
	}

	public void setNode(String node) {
		this.node = node;
	}

	@Transient
	public int getCounter() {
		return counter;
	}

	public void setCounter(int counter) {
		this.counter = counter;
	}
	
	synchronized public void addConter() {
		this.counter++;
	}
	@Transient
	public long getResetTime() {
		return resetTime;
	}

	public void setResetTime(long resetTime) {
		this.resetTime = resetTime;
	}
	
	@Transient
	public String toString() {
		return this.provId + "|" +  this.node + "|" +this.period + "|" + this.limitRecNum;
	}

}
